﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.CampaignSystem.LogEntries.KingdomDecisionConcludedLogEntry
// Assembly: TaleWorlds.CampaignSystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E85F8C15-4DF6-4E9C-A58A-29177E40D07A
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll

using System.Collections.Generic;
using TaleWorlds.CampaignSystem.Election;
using TaleWorlds.Localization;
using TaleWorlds.SaveSystem;

#nullable disable
namespace TaleWorlds.CampaignSystem.LogEntries
{
  public class KingdomDecisionConcludedLogEntry : LogEntry, IChatNotification
  {
    [SaveableField(1)]
    public readonly Kingdom Kingdom;
    [SaveableField(3)]
    private readonly bool _isVisibleNotification;
    [SaveableField(4)]
    private readonly TextObject _notificationText;

    internal static void AutoGeneratedStaticCollectObjectsKingdomDecisionConcludedLogEntry(
      object o,
      List<object> collectedObjects)
    {
      ((LogEntry) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
      base.AutoGeneratedInstanceCollectObjects(collectedObjects);
      collectedObjects.Add((object) this.Kingdom);
      collectedObjects.Add((object) this._notificationText);
    }

    internal static object AutoGeneratedGetMemberValueKingdom(object o)
    {
      return (object) ((KingdomDecisionConcludedLogEntry) o).Kingdom;
    }

    internal static object AutoGeneratedGetMemberValue_isVisibleNotification(object o)
    {
      return (object) ((KingdomDecisionConcludedLogEntry) o)._isVisibleNotification;
    }

    internal static object AutoGeneratedGetMemberValue_notificationText(object o)
    {
      return (object) ((KingdomDecisionConcludedLogEntry) o)._notificationText;
    }

    public override CampaignTime KeepInHistoryTime => CampaignTime.Weeks(1f);

    public bool IsVisibleNotification => this._isVisibleNotification;

    public override ChatNotificationType NotificationType
    {
      get => this.PoliticalNotification((IFaction) this.Kingdom);
    }

    public KingdomDecisionConcludedLogEntry(
      KingdomDecision decision,
      DecisionOutcome chosenOutcome,
      bool isPlayerInvolved)
    {
      this.Kingdom = decision.Kingdom;
      this._isVisibleNotification = !isPlayerInvolved;
      this._notificationText = decision.GetChosenOutcomeText(chosenOutcome, decision.SupportStatusOfFinalDecision, true);
    }

    public override string ToString() => this.GetNotificationText().ToString();

    public TextObject GetNotificationText() => this._notificationText;
  }
}
